package com.topvision.myviewtest.design_patterns.strategy_mode;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

import com.topvision.myviewtest.design_patterns.strategy_mode.impl.AttackImpl;
import com.topvision.myviewtest.design_patterns.strategy_mode.impl.DefendImpl;
import com.topvision.myviewtest.design_patterns.strategy_mode.impl.DisplayImpl;
import com.topvision.myviewtest.design_patterns.strategy_mode.impl.RunImpl;
import com.topvision.myviewtest.design_patterns.strategy_mode.user.Role;
import com.topvision.myviewtest.design_patterns.strategy_mode.user.RoleA;

/**
 * @author lucy
 * @date 2018-10-11 17:10
 * @description //TODO
 */

public class TestActivity extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TextView textView = new TextView(this);
        setContentView(textView);
    }

    private void test() {
        Role roleA = new RoleA();
        roleA.setAttackBehavior(new AttackImpl())
                .setDefendBehavior(new DefendImpl())
                .setDisplayBehavior(new DisplayImpl())
                .setRunBehavior(new RunImpl());
        roleA.run();
        roleA.attack();
        roleA.defend();
        roleA.display();
    }
}
